home *** CD-ROM | disk | FTP | other *** search
- JIM ADAMS LIBRARY ARCHIVE '96
- Copyright (c) 1996 by Jim Adams, All right reserved.
-
- The author, Jim Adams, gives full permission to duplicate
- these files only for personal use. This may only be
- duplicated with all the files, including this one.
- No part of this file may be published without prior
- written permission by the author.
-
-
- Hello!
-
- Contained within is my custom libraries I use for both my BORLAND
- and WATCOM compilers. These work by typing as the first line depending
- on your compiler:
-
- #define COMPILER_BORLAND
- or
- #define COMPILER_WATCOM
-
- Why not use __BORLANDC__ or __WATCOMC__ you ask? Well you should
- not assume a compiler you're using has a preset definition like that.
- I make my libraries work on a multitude of systems and OS's just by
- replacing a little bit of code.
-
- Anyways, the following files are contained: (all are for 320x200x256color)
-
- VIDEO.C All functions for handling video modes, palettes, etc.
- FONT.C Font printing to graphics screen
- BLOCK.C Tile block drawing
- PCX.C Pcx loading and saving routines
- KEYTRAP.C Keyboard interrupt services for multiple keypress's
-
-
- A listing of important functions:
- VIDEO.C:
- - gfx_screen is a pointer to the video screen.
- To set a pixel at 0x0 with color 15: gfx_screen[0]=15;
- or copy a offscreen buffer to screen: memcpy(gfx_screen,buf,64000);
-
- - setvmode sets a video mode.
- for 320x200x256color: setvmode(0x13);
- and back to text mode: setvmode(0x03);
-
- - palette_set will set a palette passed to it
- palette_set(palette,border_color,num_colors);
-
- - palette_get will read a palette into a buffer from the video
- palette_get(palette);
-
- - display_screen wil blit a buffer to video screen
- display_screen(offscreen_buffer);
-
- - clear_screen will clear a buffer to selected color
- clear_screen(offscreen_buffer,0);
-
- FONT.C
- - font_printxy will print a string at cords supplies
- font_printxy(gfx_screen,0,0,"Hello!");
- NOTE: This function has the following embeded commands:
- These are preceeded by the '/' character.
-
- /b : sets the background draw color 256 = transparent
- /t : sets the text draw color
- /n : is a form feed
- /r : is a carriage return
- /N : is form feed and carriage return
-
- BLOCK.C
- - block_clip finds a graphic retangle on the buffer provided and clips it
- (char*)block = block_clip(gfx_screen);
-
- - block_clip2 clips a block at x,y with a width and height
- (char*)block = block_clip2(gfx_screen,x,y,width,height);
-
- - block_draw will draw a captured block to a buffer
- block_draw((char*)block,x,y,gfx_screen);
-
- PCX.C
- - pcx_load loads a 320x200 pcx file into a buffer and palette
- pcx_load("file.pcx",pcx_buffer,pcx_palette);
-
- - pcx_save saves a 320x200 pcx file from a buffer and palette
- pcx_save("file.pcx",pcx_buffer,pcx_palette);
-
- KEYTRAP.C
- - key_press is an array of the keys currently pressed or released
- these are arrayed by scan code
- to check for a ESC press
- if(key_press[1]) { }
-
- - key_lock allows for one-shot keypress's. Just clear the keypress
- and set the key_lock to one.
- to lock the ESC key:
- if(key_press[1]) {
- key_lock(1);
- }
-
- - key_trap will trap the keyboard for our use
- key_trap();
-
- - key_untrap will release keyboard control back to former handler
- key_untrap();
-